package com.ctshk.rpc.order.custom.util;

import com.ctshk.rpc.order.custom.code.CertificateTypeCode;

import java.util.Objects;

/**
 * 太平保险工具类
 */
public class PacificUtil {

    /** 太平洋账号 **/
    //仲介人代碼
    public static final String INTERMEDIARYCODE = "020100210000";
    //分配方案號
    public static final String SOLUTIONCODE = "0100000000000000010000";
    //登陆B2B出单系统的用户名
    public static final String OPERATORCODE = "0100000001";
    //協議號
    public static final String AGREEMENTNO = "010000000000000001";



    //年龄范围
    public static final int CHILD_AGE = 17;
    public static final int ADULT_AGE = 75;

    //太平保险年龄段Code
    public static final String CHILD_CODE = "28";
    public static final String ADULT_CODE = "29";
    public static final String OLDMAN_CODE = "30";


    /**
     * 获取证件类型
     */
    public static String getIdentifyType(Long certificateTypeId){
        if (certificateTypeId == null){
            return null;
        }
        if (Objects.equals(certificateTypeId, CertificateTypeCode.IDENTIFY_HK.getCode())){
            return CertificateTypeCode.IDENTIFY_HK.getMsg();
        }else if (Objects.equals(certificateTypeId, CertificateTypeCode.PASSPORT.getCode())){
            return CertificateTypeCode.PASSPORT.getMsg();
        }else if (Objects.equals(certificateTypeId, CertificateTypeCode.RETURN_HOME.getCode())){
            return CertificateTypeCode.RETURN_HOME.getMsg();
        }
        return null;
    }

    /**
     * 获取年龄类型
     */
    public static String getAgeType(Integer age){
        if (age == null){
            return null;
        }
        if (age <= CHILD_AGE){
            return CHILD_CODE;
        }else{
            if (age <= ADULT_AGE){
                return ADULT_CODE;
            }else{
                return OLDMAN_CODE;
            }
        }
    }

}
